package com.puppet.building182.config;

import com.alibaba.cloud.ai.dashscope.agent.DashScopeAgent;
import com.alibaba.cloud.ai.dashscope.agent.DashScopeAgentOptions;
import com.alibaba.cloud.ai.dashscope.api.DashScopeAgentApi;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class AiConfig {
    @Value("${spring.ai.dashscope.api-key}")
    private String api_Key;

    @Value("${spring.ai.dashscope.agent.app-id}")
    private String app_id;


    // 向 SpringIOC容器中 配置 dashScopeAgent 类的对象
    // 将AI所需的一些硬性配置放在这个位置
    @Bean
    public DashScopeAgent dashScopeAgent(DashScopeAgentApi dashScopeAgentApi){

        return new DashScopeAgent(dashScopeAgentApi,

                DashScopeAgentOptions.builder()
                        .withAppId(app_id)
                        .withIncrementalOutput(true)
                        .withHasThoughts(true)
                        .withSessionId("current_session_id")
                        .build());
    }
}
